home *** CD-ROM | disk | FTP | other *** search
- ******* ibox.lib/DrawThinBevel **********************************************
- *
- * NAME
- * DrawThinBevel -- Draws a thin bevel box, given an IBox and pen colors
- *
- * SYNOPSIS
- * DrawThinBevel( rp, box, ulpen, lrpen )
- * A1 A0 D0 D1
- *
- * void __asm DrawThinBevel( register __a1 struct RastPort *,
- * register __a0 struct IBox *,
- * register __d0 WORD,
- * register __d1 WORD );
- *
- * FUNCTION
- * This function uses PolyDraw to render a bevel box. The horizontal
- * thickness of the vertical lines is hard-coded at 1, and the vertical
- * thickness of the horizontal lines is hard-coded at 1, for speed.
- *
- * INPUTS
- * rp - RastPort to render to
- * box - box to render
- * ulpen - pen number to render upper-left lines in
- * lrpen - pen number to render lower-right lines in
- *
- * EXAMPLE
- *
- * NOTES
- *
- * BUGS
- *
- * SEE ALSO
- * intuition/intuition.h, DrawBevel()
- *
- *****************************************************************************
- * Written by Talin
- *
-
- include "intuition/intuition.i"
-
- SECTION text,CODE
-
- xdef _DrawThinBevel
- xref _LVOSetAPen,_LVOMove,_LVOPolyDraw,_GfxBase
-
- _DrawThinBevel
- movem.l d2-d7/a2/a6,-(sp)
- move.l d1,d2 ; d2 <-- lrpen
- move.l a1,a2 ; a2 <-- copy of RP
- move.l _GfxBase,a6 ; a6 register
-
- moveq #0,d4 ; clear upper half of regs
- moveq #0,d5
- moveq #0,d6
- moveq #0,d7
- movem.w (a0),d4/d5/d6/d7 ; d4 <-- ibox_Left
- ; d5 <-- ibox_Top
- ; d6 <-- ibox_Width
- ; d7 <-- ibox_Height
- add.w d4,d6 ; d6 <-- right
- add.w d5,d7 ; d7 <-- bottom
- subq.w #1,d6 ; d6 <-- left - 1
- subq.w #1,d7 ; d7 <-- bottom - 1
-
- ;---------- draw upper left part
-
- move.w d5,-(sp) ; coords[3] (y) = TOP
- subq.w #1,d6 ; subtract 1 from RIGHT
- move.w d6,-(sp) ; coords[2] (x) = RIGHT-1
-
- move.w d5,-(sp) ; coords[1] (y) = TOP
- move.w d4,-(sp) ; coords[0] (x) = LEFT
-
- ; move.l d0,d0 ; upper left pen color
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOSetAPen(a6) ; set it
-
- move.l d4,d0 ; d0 <-- LEFT
- move.l d7,d1 ; d1 <-- BOTTOM
- subq.w #1,d1 ; d1 <-- BOTTOM-1
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOMove(a6) ; Move to cursor coords
-
- moveq #2,d0 ; draw 2 points
- move.l sp,a0 ; address of coords
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOPolyDraw(a6) ; draw the line
-
- lea 8(sp),sp
-
- ;---------- draw lower right part
-
- addq.w #1,d6 ; d6 <-- RIGHT (fix from before)
-
- move.w d7,-(sp) ; coords[3] (y) = BOTTOM
- move.w d4,-(sp) ; coords[2] (x) = LEFT + 1
-
- move.w d7,-(sp) ; coords[1] (y) = BOTTOM
- move.w d6,-(sp) ; coords[0] (x) = RIGHT
-
- move.l d2,d0 ; lower right pen color
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOSetAPen(a6) ; set it
-
- move.l d6,d0 ; d0 <-- RIGHT
- move.l d5,d1 ; d1 <-- TOP
- addq.w #1,d1 ; d1 <-- TOP + 1
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOMove(a6) ; Move to cursor coords
-
- moveq #2,d0 ; draw 2 points
- move.l sp,a0 ; address of coords
- move.l a2,a1 ; a1 <-- rp
- jsr _LVOPolyDraw(a6) ; draw the line
-
- lea 8(sp),sp
-
- movem.l (sp)+,d2-d7/a2/a6
- rts
-
- end
-